package J20250330_real;

/**
 * Created with IntelliJ IDEA.
 * Description: 星际旅行——https://www.lanqiao.cn/problems/19726/learning/
 * User: 王圆豪
 * Date: 2025-04-06
 * Time: 16:16
 */
import java.util.*;
import java.math.*;
// 1:无需package
// 2: 类名必须Main, 不可修改

public class Main10 {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int m = scan.nextInt();
        int Q = scan.nextInt();
        HashMap<Integer,List<Integer>> map = new HashMap<>();
        for(int i = 0; i < m; i++){
            int a = scan.nextInt();
            int b = scan.nextInt();
            if(!map.containsKey(a)) map.put(a,new ArrayList<>());
            if(!map.containsKey(b)) map.put(b,new ArrayList<>());
            map.get(a).add(b);
            map.get(b).add(a);
        }
        double count = 0;
        for(int i = 0; i < Q; i++){
            int x = scan.nextInt();
            int y = scan.nextInt();
            boolean[] vis = new boolean[n+1];
            Queue<Integer> q = new LinkedList<>();
            int step = 0;
            q.add(x);
            vis[x] = true;
            while(!q.isEmpty() && step < y){
                int sz = q.size();
                for(int j = 0; j < sz; j++){
                    int p = q.poll();
                    List<Integer> tmp = map.get(p);
                    for(int k : tmp){
                        if(!vis[k]){
                            q.add(k);
                            vis[k] = true;
                        }
                    }
                }
                step++;
            }
            count += func(vis);
            vis = new boolean[n+1];
        }
        count /= Q;
        count = new BigDecimal(count).setScale(2,RoundingMode.HALF_UP).doubleValue();
        System.out.printf("%.2f", count);
        scan.close();
    }

    static double func(boolean[] vis){
        double ret = 0;
        for(boolean tmp : vis){
            if(tmp) ret++;
        }
        return ret;
    }
}